cmake_minimum_required(VERSION 3.15)
project(cxi_controls)
include(../cmake/utils.cmake)
find_package(Qt5 COMPONENTS Widgets Core Gui Designer REQUIRED)
add_standard_module(${PROJECT_NAME} include/controls ON ON)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Widgets Qt5::Gui)
if (BUILD_IN_LOCAL)
    target_link_libraries(${PROJECT_NAME} PRIVATE cxi_common)
else ()
    find_package(cxi_common REQUIRED)
    target_link_libraries(${PROJECT_NAME} PRIVATE cxi_common)
endif ()

copy_imported_dependencies(${PROJECT_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) #

install(TARGETS ${PROJECT_NAME}
        EXPORT CxiCommonPcTargets
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
        INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

add_subdirectory(designer)

if (DEFINED DESIGNER_DEST_DIR)
    install_designer_dependencies()
endif ()
